package ipt.dao;


import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;

public class ConnectionTXTFactory {
	
        private static final String DRIVER_CLASS_NAME = "sun.jdbc.odbc.JdbcOdbcDriver";
        private static final String CONNECTION_URL = "jdbc:odbc:PruebaCurso";
        private static final String DB_USER = "";
        private static final String DB_PWD = "";

        private static ConnectionTXTFactory connectionFactory = null;

        private ConnectionTXTFactory() {
                try {
                        Class.forName(DRIVER_CLASS_NAME);
                } catch (ClassNotFoundException e) {
                        e.printStackTrace();
                }
        }

        public Connection getConnection() throws SQLException {
                Connection conn = null;
                conn = DriverManager.getConnection(CONNECTION_URL, DB_USER, DB_PWD);
                return conn;
        }

        public static ConnectionTXTFactory getInstance() {
                if (connectionFactory == null) {
                        connectionFactory = new ConnectionTXTFactory();
                }
                return connectionFactory;
        }
}